@import 'weight';

@mixin type($size: 'default', $weight: 'default') {
  $size_: $font-size-base;
  $weight_: $font-weight-normal;
  $lineheight_: $line-height-base;
  $marginbottom_: $paragraph-margin-bottom;
  @if variable-exists(type) {
    $list: map-get($type, $size);
    //do size
    @if map-has-key($type, $size) {
      $size_: nth($list, 1);
      $weight_: nth($list, 2);
      $lineheight_: $headings-line-height;
      $marginbottom_: $headings-margin-bottom;
    }
    //check weight
    @if $weight != 'default' {
      $weight_: $weight;
    }
  } @else {
    @warn "Variable $type does not exist";
  }
  font-size: $size_;
  @include weight($weight_);
  //add margin-bottom
  margin-bottom: $marginbottom_;
  //add line-height
  line-height: $lineheight_;
}
